package com.cskaoyan.javase.oop1._6bigexercise._1pvz;

/**
 * @description: 僵尸类
 * @author: wuguidong@cskaoyan.onaliyun.com
 **/

public class Zombie {
    //属性
    String name;
    int hp;
    int damage; //攻击力

    //持有植物的引用
    Plant p;

    //行为
    public void eat() {
        System.out.println("脑子真香!");
    }

    public void run() {
        System.out.println("向你的脑子走来!");
    }

    public void attack() {
        System.out.println("我攻击了" + p.name);
    }

    public void beingAttacked() {
        System.out.println("我被" + p.name + "攻击了,还剩下" + (this.hp - p.damage) + "点血量!");
    }

    //构造方法


    public Zombie(String name, int hp, int damage) {
        this.name = name;
        this.hp = hp;
        this.damage = damage;
    }

    public Zombie() {
    }
}
